﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Autofac
{
    /* 参考自官方文档 潘帅阳2019年1月23日16:10:48
     https://autofaccn.readthedocs.io/zh/latest/getting-started/index.html
         */
    public interface IOutput
    {
        void Write(string content);
    }
    public class ConsoleOutput : IOutput
    {
        public void Write(string content)
        {
            Console.WriteLine(content);
        }
    }
    public interface IDateWriter
    {
        void WriteDate();
        void WriteTom();
    }

    public class TodayWriter : IDateWriter
    {
        private IOutput _output;
        public TodayWriter(IOutput output)
        {
            this._output = output;
        }

        public void WriteDate()
        {
            this._output.Write(DateTime.Today.ToShortDateString());
        }

        public void WriteTom()
        {
            Console.WriteLine(DateTime.Today.AddDays(1).ToShortDateString());
        }
    }
}
